// pages/PartyArtifact/Scfis/scfis.js
Page({
  data: {
    num1: '',
    num2: '',
    result: null
  },

  onInput1(e) {
    this.setData({ num1: e.detail.value });
  },

  onInput2(e) {
    this.setData({ num2: e.detail.value });
  },

  calculate() {
    const { num1, num2 } = this.data;
    
    // 验证输入
    if (num1 === '' || num2 === '') {
      wx.showToast({
        title: '请输入完整数字',
        icon: 'none'
      });
      return;
    }
    
    const n1 = parseFloat(num1);
    const n2 = parseFloat(num2);
    
    if (isNaN(n1) || isNaN(n2)) {
      wx.showToast({
        title: '请输入有效数字',
        icon: 'none'
      });
      return;
    }
    
    // 计算公式: (num1/850*1000*0.25) + (num2/1595*1000*0.75)
    const part1 = (n1 / 850) * 1000 * 0.25;
    const part2 = (n2 / 1595) * 1000 * 0.75;
    const result = part1 + part2;
    var that=this;
    that.setData({
      result:result.toFixed(2)
    })
  }
});